//
//  ViewController2.m
//  JSON
//
//  Created by Justsoso on 16/3/25.
//  Copyright © 2016年 Justsoso. All rights reserved.
//

#import "ViewController2.h"

@interface ViewController2 ()<UITableViewDataSource,NSXMLParserDelegate>

@property (nonatomic,strong) NSMutableArray *list;
@property (weak, nonatomic) IBOutlet UITableView *tableView;

@end

@implementation ViewController2

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    // 练习
    // 1. 制作一个全国天气应用
    // http://flash.weather.com.cn/wmaps/xml/china.xml
    //
    // 第一页面显示全国省天气列表(表格)
    // 点省后，显示这个省里城市的天气信息列表
    // 点城市后,显示这个城市下区的信息列表
    
    // 2. 解析NotesTestData.xml,用表格显示出来
    
    NSString *urlStr = @"http://flash.weather.com.cn/wmaps/xml/china.xml";
    NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlStr]];
    NSError *error;
    NSDictionary *resiltDict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];
    NSLog(@"%@",resiltDict);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.list.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
    if (cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell"];
    }
    
//    Video *v = self.list[indexPath.row];
//    cell.textLabel.text = v.name;
//    cell.detailTextLabel.text = v.url;
//    
//    NSString *imageUrlStr = [@"http://120.25.226.186:32812/" stringByAppendingString:v.image];
//    NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:imageUrlStr]];
//    UIImage *image = [UIImage imageWithData:imageData];
//    cell.imageView.image = image;
    
    return cell;
}

@end
